<?php

namespace App\Console\Commands;

use App\Wen\Utils\Settings;
use Illuminate\Console\Command;

class ChmodNecessaryFiles extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'chmod:run';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '对必要的文件进行提权';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $line1 = 'line1: ';
        $line2 = 'line2: ';
        $line3 = 'line3: ';
        $line4 = 'line4: ';

//        $line2 .= exec( 'chmod -R ugo+rw '.storage_path(''));
//        $line3 .= exec( 'chmod ugo+rwx '.app_path('Extensions'));
        if(file_exists('/tmp/swoole_loader.log')){
            $line4 .= exec('rm -f /tmp/swoole_loader.log');
        }

        _logger_(__file__, __line__, $line1."\n".$line2."\n".$line3."\n".$line4);
        return 0;
    }
}
